<template>
  <a-card :bordered="false" :style="{ marginTop: '12px',height:'513px' }">
    <span slot="title"> <a-icon type="tags" style="color:#3393FC;margin-right: 5px" theme="filled"/>流程中心</span>
    <a slot="extra" @click="loadMore">更多</a>
    <template>
      <a-tabs @change="callback">
        <a-tab-pane key="1" >
          <span slot="tab" >
            <a-badge :count="countNum" :offset="[6, -4]" >
              待办
            </a-badge>
          </span>
          <my-running-task-list ref="runTaskList" @ok="runOk" @doTotalNum="doTotalNum" tableValue="待办"></my-running-task-list>
        </a-tab-pane>
        <a-tab-pane tab="已办" key="2">
          <my-complated-task-list ref="complatedList" @ok="complatedOk" tableValue="已办"></my-complated-task-list>
        </a-tab-pane>
        <a-tab-pane tab="知会" key="3">
          <my-cc-his-process-list ref="ccProcessList" @ok="ccOk" tableValue="知会"></my-cc-his-process-list>
        </a-tab-pane>
        <a-tab-pane tab="发起" key="4">
          <my-send-task-list ref="sendTaskList" @ok="sendOk" tableValue="发起"></my-send-task-list>
        </a-tab-pane>
        <a-tab-pane tab="待发" key="5">
          <!-- <my-send-task-list ref="sendTaskList" @ok="sendOk" tableValue="待发"></my-send-task-list> -->
          <MyCommittedList tableValue="待发" ref="myCommittedList" @ok="committedOk"></MyCommittedList>
        </a-tab-pane>
      </a-tabs>
    </template>
  </a-card>
</template>

<script>
  import MyRunningTaskList from './MyRunningTaskList'
  import MySendTaskList from './MySendTaskList'
  import MyComplatedTaskList from './MyComplatedTaskList'
  import MyCcHisProcessList from './MyCcHisProcessList'
  import MyCommittedList from './MyCommittedList';
  export default {
    name: 'EoaCmsMyProcess',
    components: {
      MyRunningTaskList,
      MySendTaskList,
      MyComplatedTaskList,
      MyCcHisProcessList,
      MyCommittedList
    },
    data () {
      return {
        processUpdate: false,
        countNum: 0
      }
    },
    methods: {
      // 返回总数
      doTotalNum (e) {
        this.countNum = e
      },
      /* 待处理数 */
      // doTotal() {
      //      this.$ref.runTaskList.;
      // },
      loadMore() {
        this.$router.push({
          path: '/bpm/task/MyTaskList'
        })
      },
      runOk() {
        this.$refs.runTaskList.loadData();
        this.processUpdate = true;
      },
      ccOk() {
        this.$refs.ccProcessList.loadData();
        this.processUpdate = true;
      },
      sendOk() {
        this.$refs.sendTaskList.loadData();
        this.processUpdate = true;
      },
      committedOk() {
        this.$refs.myCommittedList.loadData();
        this.processUpdate = true;
      },
      complatedOk() {
        this.$refs.complatedList.loadData();
        this.processUpdate = true;
      },
      callback(key) {
        if (key === '2' && this.processUpdate) {
          this.$refs.ccProcessList.loadData()
          this.processUpdate = false;
        }
      }
    }
  }
</script>

<style scoped>

</style>
